import { useState } from 'react'

// 独立更新的计数器
function TheAloneButton() {
    let [count, setCount] = useState(0)
    function goClick() {
        setCount(++count)
    }

    return (
        <button onClick={goClick}>点击了 {count} 次</button>
    )
}

// 共同更新的计数器
function TheTogetherButton({ count, toClick }) {
    return (
        <button onClick={toClick}>点击了 {count} 次</button>
    )
}
export {
    TheAloneButton,
    TheTogetherButton
}